Ext.define('OrderConvert.view.order.OrderWinController', {
    extend: 'Ext.app.ViewController',
    alias: 'controller.order-orderwin',
    
     requires : [
        "OrderConvert.controller.order.OrderController"
    ],
    
    
    addOrder : function(btn){
        var orderController = Ext.create("OrderConvert.controller.order.OrderController");
        var win = btn.up("window");
        var form = win.down("form");
        if(form.isValid()) {
            form.submit({
                url : OrderConvertUrl.constant.serverUrl + 'order/add',
                waitMsg: '文件上传中...',
                success: function(form, action) {
                    console.log(action);
                    form.reset();
                    win.close();
                   // Ext.Msg.alert('Success',"success");
                    orderController.reloadGridData();
                },
                failure: function(form, action) {
                    console.log(action);
                     win.close();
                     orderController.reloadGridData();
                    // Ext.Msg.alert('Failed', "failure");
                }
            });
        }
    },
    
    cancelOrder : function(btn){
        var win = btn.up("window");
        win.close();
    }
    
});
